using System;
using System.Text;
using System.Collections.Generic;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Microsoft.Practices.EnterpriseLibrary.Data;
using System.Xml;
using System.IO;
using System.Xml.XPath;
using Instedd.Labs.Forms.Library;
using System.Data;
using System.Data.Common;
using Instedd.Labs.Geo.Library.Kml;

namespace Instedd.Forms.Library.Tests
{
    /// <summary>
    /// Summary description for UnitTest1
    /// </summary>
    [TestClass]
    public class SurveyFixture
    {
        [TestMethod]
        public void CalculateTotalWellWithCeroTotalExposedReturnsTotalOccupants()
        {
            Survey survey = new Survey();

            survey.AttendedConcert = survey.AttendeeContact = survey.SymptomsPresent = survey.Deceased = 0;
            survey.TotalOccupants = 10;

            Assert.AreEqual(0, survey.TotalExposed);
            
            Assert.AreEqual(10, survey.TotalWell);
        }

        [TestMethod]
        public void CalculateTotalWellWithNonCeroTotalExposedReturnsCero()
        {
            Survey survey = new Survey();

            survey.TotalOccupants = survey.AttendedConcert = 10;

            Assert.IsTrue(survey.TotalExposed > 0);
            
            Assert.AreEqual(0, survey.TotalWell);
        }

        [TestMethod]
        public void CalculateTotalExposedWithMoreThanCeroAttendedConcertReturnsTotalOccupants()
        {
            Survey survey = new Survey();

            survey.TotalOccupants = 12;
            survey.AttendedConcert = 10;

            Assert.AreEqual(12, survey.TotalExposed);
        }

        [TestMethod]
        public void CalculateTotalExposedWithCeroAttendedConcertAndCeroAttendeeContactAndCeroSymptomsPresentAndCeroDeceasedReturnsCero()
        {
            Survey survey = new Survey();

            survey.AttendedConcert = survey.AttendeeContact = survey.SymptomsPresent = survey.Deceased = 0;

            Assert.AreEqual(0, survey.TotalExposed);
        }

        [TestMethod]
        public void CalculateTotalExposedNotIllReturnsTotalExposedMinusSymptomsPresent()
        {
            Survey survey = new Survey();

            survey.SymptomsPresent = survey.AttendedConcert = 10;
            survey.TotalOccupants = 12;

            Assert.AreEqual(12, survey.TotalExposed);
            Assert.AreEqual(10, survey.SymptomsPresent);

            Assert.AreEqual(2, survey.TotalExposedNotIll);
        }

        [TestMethod]
        public void CalculateTotalExposedAndIllReturnsSymptomsPresent()
        {
            Survey survey = new Survey();

            survey.SymptomsPresent = 15;

            Assert.AreEqual(15, survey.TotalExposedAndIll);
        }

        [TestMethod]
        public void CalculateTotalReceivedTreatmentReturnsReceivedIvTreatment()
        {
            Survey survey = new Survey();

            survey.ReceivedIvTreatment = 14;

            Assert.AreEqual(14, survey.TotalReceivedTreatment);
        }

        [TestMethod]
        public void CalculateTotalRecoveredReturnsRecovered()
        {
            Survey survey = new Survey();

            survey.Recovered = 8;

            Assert.AreEqual(8, survey.TotalRecovered);
        }
        
        [TestMethod]
        public void CalculateTotalDeceasedReturnsDeceased()
        {
            Survey survey = new Survey();

            survey.Deceased = 14;

            Assert.AreEqual(14, survey.TotalDeceased);
        }
    }
}
